<?php
/**
 * Created by PhpStorm.
 * User: Heido
 * Date: 2019/10/21
 * Time: 14:29
 */

namespace app\common\controller;


use app\admin\traits\Result;
use think\Controller;

class Common extends Controller
{

    public function setStatus($id,$status,$object = 'app\admin\model\Article'){
        $change_status = $status == 1 ? 0:1;
        $article = $object::where(['id'=>$id])->update(['status'=>$change_status]);
        if ($article !== false){
            return Result::success('操作成功');
        }else{
            return Result::error('操作失败');
        }
    }

}